
;------------------------------------------------------------
.code
new_mod_interf	proc
			push esi
			push edi
		_@getMem 2+4+MOD_INTERF_CREATING_OFFSET+1+1+(1+1+(1+1+1))+1
			test eax,eax
			jz short nmiExit
		push eax
			mov edi,eax
			xor eax,eax
			mov al,0ebh
			stosw
			mov al,2+4
			stosd
			mov eax,(MOD_INTERF_VERSION shl (8*3))+MOD_INTERF_MAGIC
			stosd
			mov al,(1+(1+1+(1+1+1))) shl 2
			stosb
			mov al,(1+1+(1+1+1)) shl 2
			stosb
			xor eax,eax
			stosd
			stosw
		pop eax

	nmiExit:
			pop edi
			pop esi
			ret
new_mod_interf		endp
;------------------------------------------------------------
add_mod_interf_memb	proc lpInterf,lpszName,address,typ,access
			push edi
			push esi
			push ecx
			push ebx

			mov edi,lpInterf
			push edi
			call IsThisModule
			test eax,eax
			jz  amimExit;short

			mov eax,address
			test eax,eax
			jz  amimExit;short

			mov esi,modules_root
		assume esi: ptr _@module_link

		@@:
			test esi,esi
			jz short @f

			mov eax,[esi].lpModule
			sub eax,edi
			jz  amimExit;short

			mov esi,[esi].lpNextModule
			jmp short @b
		@@:


	;new member creating
			mov esi,lpszName
			mov eax,esi
			test esi,esi
			jz  amimExit;short

			push esi
			call strlen
			inc eax
		push eax
			add eax,4+4+4+4+4
		_@getMem eax
			test eax,eax
		pop ecx
			jz  amimExit;short

		push edi
			mov edi,eax
				push eax

		_@mod_interf_cr_chunk_begin edi

		_@mod_interf_cr_compute_len ecx
		_@stos_len ecx,eax

			push ecx	;len
			push esi	;from
			push edi	;to
		add edi,ecx
			call ___@cpyMem

				pop esi

			xor eax,eax
	;comment..
			stosb
	;type
			mov eax,typ
			test al,al
			jz short @f

			or al,MOD_MEMB_ACCESS_R or MOD_MEMB_ACCESS_W
		@@:
			stosb
	;params..
			xor eax,eax
			stosb
	;addr
			mov eax,address
			stosd
	;store memb len
			push edi
			call _@mod_interf_cr_chunk_end 
			mov edi,eax

	;ecx = member len
			mov ecx,edi
			sub ecx,esi
		pop edi

			add edi,dword ptr [edi+2]
			add edi,MOD_INTERF_CREATING_OFFSET

;			mov esi,edi

		call ___@get_bin_mod_len
			;interf len
			mov ecx,edi
			add ecx,eax

		call ___@get_bin_mod_len
			;main mod len
			add edi,eax

			cmp edi,ecx
			jnc short @f

			

		@@:

			xor ecx,ecx

			

	amimExit:
			pop ebx
			pop ecx
			pop esi
			pop edi
			ret
add_mod_interf_memb		endp
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------
;------------------------------------------------------------

